YOLOv3 (You Only Look Once version 3) algorithm is widely used in target detection tasks. Although some improved algorithms based on YOLOv3 have achieved some results, there are still problems of insufficient representation ability and low detection accuracy, especially for the detection of small targets. In order to solve the above problems, a small target detection algorithm for remote sensing images based on YOLOv3 was proposed. Firstly, K-means Transformation (K-means-T) algorithm was used to optimize the size of anchor box, so that the matching degree between the priori box and ground truth box was improved. Secondly, the confidence loss function was optimized to solve the problem of uneven distribution of hard and easy samples. Finally, attention mechanism was introduced to improve the algorithm’s ability to perceive the detailed information. Results of the experiments carried out on RSOD dataset show that compared with the original YOLOv3 algorithm and YOLOv4 algorithm, the proposed algorithm has the detection Average Precision (AP) on the small target class “aircraft” increased by 7.3 percentage points and 5.9 percentage points respectively, illustrating that the proposed improved algorithm can detect small targets in remote sensing images effectively, with higher accuracy.